import {createRouter, createWebHistory} from 'vue-router'
import Layout from "@/layout/Layout.vue";

const routes = [


    {
        path: '/',
        name: 'Layout',
        component: Layout,
        redirect: "/Home",  //路由重定向，当访问/时，自动跳转到user
        //子菜单的路由
        children: [

            {
                path: '/User',
                name: 'User',
                //引入对应的界面
                component: () => import("@/views/User.vue"),
                meta: {showSidebar: false}
            },
            {
                path: '/Favorite',
                name: 'Favorite',
                component: () => import("@/views/Favorite.vue"),
                meta: {showSidebar: false}
            },
            {
                path: '/Cart',
                name: 'Cart',
                component: () => import("@/views/Cart.vue"),
                meta: {showSidebar: false}
            },

            {
                path: '/ProductDetailInfo',
                name: 'ProductDetailInfo',
                component: () => import("@/views/ProductDetailInfo.vue"),
                meta: {showSidebar: false}
                //引入对应的界面
            },


            {
                path: '/PersonalCenterSidebar',
                name: 'PersonalCenterSidebar',
                component: () => import("@/views/PersonalCenterSidebar.vue"),
                meta: {showSidebar: false}
            },
            {
                path: '/UserOrder',
                name: 'UserOrder',
                component: () => import("@/views/UserOrder.vue"),
                meta: {showSidebar: false}
            },
            {
                path: '/ProductManager',
                name: 'ProductManager',
                component: () => import("@/views/ProductManager.vue"),
                meta: {showSidebar: true}
            },
            {
                path: '/OrderManager',
                name: 'OrderManager',
                component: () => import("@/views/OrderManager.vue"),
                meta: {showSidebar: true}
            },
            {
                path: '/FinancialManager',
                name: 'FinancialManager',
                component: () => import("@/views/FinancialManager.vue"),
                meta: {showSidebar: true}
            },
            {
                path: '/TraderManager',
                name: 'TraderManager',
                component: () => import("@/views/TraderManager.vue"),
                meta: {showSidebar: true}
            },


            {
                path: '/Admin',
                name: 'Admin',
                component: () => import("@/views/Admin.vue"),
                meta: {showSidebar: false}
            },


            {
                path: '/Address',
                name: 'Address',
                component: () => import("@/views/Address.vue"),
                meta: {showSidebar: false}
            },
            {
                path: '/ProductStatus',
                name: 'ProductStatus',
                component: () =>import("@/views/ProductStatus")
            }


        ],


    },

    {
        path: '/Top',
        name: 'Top',
        component: () => import("@/views/Top.vue")
    },

    {
        path: '/Home',
        name: 'Home',
        component: () => import("@/views/Home.vue"),
        meta: {showSidebar: false}
    },


    {
        path: '/UserLogin',
        name: 'UserLogin',
        //此处导入Login登录界面
        component: () => import("@/views/UserLogin.vue")
    },
    //
    {
        path: '/UserRegister',
        name: 'UserRegister',
        //此处导入Login登录界面
        component: () => import("@/views/UserRegister.vue")
    },

    {
        path: '/TraderLogin',
        name: '/TraderLogin',
        component: () => import("@/views/TraderLogin.vue")
    },
    {
        path: '/TraderRegister',
        name: '/TraderRegister',
        component: () => import("@/views/TraderRegister.vue")
    },
    {
        path: '/AdminLogin',
        name: '/AdminLogin',
        component: () => import("@/views/AdminLogin.vue")
    },

    {
        path: '/AdminRegister',
        name: '/AdminRegister',
        component: () => import("@/views/AdminRegister.vue")
    },

    {
        path: '/Pay',
        name: '/Pay',
        component: () => import("@/views/Pay.vue")
    },



]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
